package com.yzh.croom.mapper;

import com.yzh.croom.model.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    @Results({
            @Result(id = true,column = "user_id",property = "userId"),
            @Result(column = "account",property = "account"),
            @Result(column = "password",property = "password"),
            @Result(column = "role_id",property = "roleId"),
            @Result(column = "status",property = "status")
    })

    @Select("select * from tb_user")
    public List<User> getAllAdmin();

    @Insert("insert into tb_user (account,password,role_id,status) values (#{account},#{password},#{roleId},#{status})")
    public int addAdmin(User user);

    @Update("update tb_user set status = #{status} where account = #{account}")
    public int updateStatus(String account,int status);
}
